package com.ycz;

import com.ycz.consumer.ConsumerTest;
import com.ycz.publish.PublishTest;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @author ycz
 * @date 2021/6/11
 *
 */
public class Application {

    public static void main(String[] args) {
        AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext();
        applicationContext.register(BasicConfig.class);
        applicationContext.refresh();

        ConsumerTest consumerTest = applicationContext.getBean("consumerTest", ConsumerTest.class);
//        consumerTest.consumerByFanout();
//        consumerTest.consumerByTopic();
//        consumerTest.consumer();

        PublishTest publishTest = applicationContext.getBean("publishTest", PublishTest.class);
//        publishTest.publisherByFanout();
//        publishTest.publishByTopic();
//        publishTest.publisher();


        System.out.println("=================================================");

        publishTest.publishWithTransaction();
        publishTest.publishWithWaitForConfirms();
        publishTest.publishWaitForConfirmsOrDie();
        publishTest.publishWaitForConfirmsListener();


        System.out.println("spring容器已启动");
    }


}
